home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Pinceles y lápices / LineJoins / LineJoins.cs next >
Encoding:
Text File  |  2002-05-14  |  1.1 KB  |  36 lines

  1. //----------------------------------------
  2. // LineJoins.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class LineJoins: PrintableForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new LineJoins());
  14.      }
  15.      public LineJoins()
  16.      {
  17.           Text = "Uniones de lφneas: Miter, Bevel, Round, MiterClipped";
  18.      }
  19.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  20.      {
  21.           Pen     penNarrow = new Pen(clr);
  22.           Pen     penWide   = new Pen(Color.Gray, cx / 16);
  23.           Point[] apt       = { new Point(1 * cx / 32, 1 * cy / 8), 
  24.                                 new Point(4 * cx / 32, 6 * cy / 8),
  25.                                 new Point(7 * cx / 32, 1 * cy / 8) };
  26.  
  27.           for (int i = 0; i < 4; i++)
  28.           {
  29.                penWide.LineJoin = (LineJoin) i;
  30.  
  31.                grfx.DrawLines(penWide, apt);
  32.                grfx.DrawLines(penNarrow, apt);
  33.                grfx.TranslateTransform(cx / 4, 0);
  34.           }
  35.      }
  36. }